package com.cloud.poetry.core.entity;

import com.alibaba.fastjson.JSON;
import lombok.Data;

/**
 * @author mengxj
 */
@Data
public class MsgBody {

    private Integer code;

    private Long from;

    private String fromName;

    private Long to;

    private String toName;

    private String message;

    public static MsgBody sendBody(int code, Long from, Long to, String message){
        MsgBody body = new MsgBody();
        body.setCode(code);
        body.setFrom(from);
        body.setTo(to);
        body.setMessage(message);
        return body;
    }

    public static MsgBody parseBody(String message){
        return JSON.parseObject(message, MsgBody.class);
    }
}
